<template>
	<view class="body">
		<xk-header title="意见反馈"></xk-header>
		<view class="list" >
			<view class="list-item header" @click="more = !more">
				<view>工单信息:  {{pmFeedback.apply_no}}</view>
				<image v-if="!more" src="/static/up.png"></image>
				<image v-else  src="/static/down.png"></image>
			</view>
			<view v-if="more" class="data-item">
				<view class="order-info">
					<view class="info-item"><view class="key">反馈类型：</view>{{feedBackType[pmFeedback.fb_type]}}</view>
					<view class="info-item"><view class="key">空间区域：</view>{{pmFeedback.fb_address}}</view>
					<view class="info-item"><view class="key">反馈问题：</view>{{pmFeedback.fb_desc}}</view>
					<view class="info-item"><view class="key">反馈人：</view>{{pmFeedback.apply_user || '暂无'}}</view>
					<view class="info-item"><view class="key">业主单位：</view>{{pmFeedback.apply_company_name || '暂无'}}</view>
					<view class="info-item"><view class="key">联系电话：</view>{{pmFeedback.apply_phone || '暂无'}}</view>
					<view class="info-item"><view class="key">反馈时间：</view>{{pmFeedback.apply_date}}</view>
					<view v-if="pmFeedback.fb_pic" class="info-item"><view class="key"></view>
						<image-list :pics="pmFeedback.fb_pic"></image-list>
					</view>
				</view>
			</view>
		</view>

		<view class="list" >
			<view class="list-item header" @click="orderMore = !orderMore">
				<view>处理记录</view>
				<image v-if="!orderMore" src="/static/up.png"></image>
				<image v-else  src="/static/down.png"></image>
			</view>
			<view v-if="orderMore" class="data-item">
				<view class="order-info">
					<view class="info-item"><view class="key">指派人：</view>{{pmFeedback.acceptor}}</view>
					<view class="info-item"><view class="key">跟进人：</view>{{pmFeedback.followman}}</view>
					<view v-if="pmFeedback.treatment" class="info-item"><view class="key">处理方案：</view>{{pmFeedback.treatment}}</view>
					<view v-if="pmFeedback.deal_time" class="info-item"><view class="key">处理时间：</view>{{pmFeedback.deal_time}}</view>
					<view v-if="pmFeedback.deal_pic" class="info-item"><view class="key"></view>
						<image-list :pics="pmFeedback.deal_pic"></image-list>
					</view>
				</view>
			</view>
		</view>

		<view v-if="pmFeedback.evaluate_result" class="list" >
			<view class="list-item header" @click="cMore = !cMore">
				<view>客户评价</view>
				<image v-if="!cMore" src="/static/up.png"></image>
				<image v-else  src="/static/down.png"></image>
			</view>
			<view v-if="cMore" class="data-item">
				<view class="order-info">
					<view class="info-item"><view class="key">评价结果：</view>{{pmFeedback.evaluate_result | pjResult}}</view>
					<view v-if="pmFeedback.evaluate_content" class="info-item"><view class="key">评价内容：</view>{{pmFeedback.evaluate_content}}</view>
				</view>
			</view>
		</view>
		<view class="common-bottom-view">
			<view class="common-btn" @click="back">返回</view>
		</view>
		<view class="common-zw"></view>
	</view>
</template>

<script>
	import moment from 'moment';
	const PJRESULT = {'10': '非常满意', '20': '满意', '30': '不满意'}
	export default {
		data() {
			return {
				more: true,
				orderMore: true,
				cMore: true,
				feedBackType: {},
				pmFeedback: {},
				defaultDate: moment().format('YYYY-MM-DD HH:mm'),
				formData: {
					pm_feedback_id: '',
					deal_time: '',
					treatment: '',
					deal_pic: '',
					deal_remark: '',
					isSubmit: true
				}
			};
		},
		filters:{
			pjResult(val){
				return PJRESULT[val]
			}
		},
		computed:{
			fbType(){
				return this.feedBackType[this.pmFeedback.fb_type]
			}
		},
		onLoad(options){
			this.formData.pm_feedback_id = options.feedBackId;
			this.initConst();
		},
		methods:{
			initConst(){
				this.$util.initFeedbackType().then((res)=>{
					console.log('initFeedbackType', res)
					this.feedBackType = res;
					this.getFeedBackData();
				})
				// let query = this.$util.formatGraphqlQuery([{
				// 	fun: 'fbTypeList:baseData_getToolDataList',	// 海报列表
				// 	params: {
				// 		code: 'PM_FEEDBACK_FBTYPE_nostr'
				// 	},
				// 	result: "data_text, data_value"
				// }])
				// this.$util.postGraphql({query}).then((res)=>{
				// 	for(let item of res.fbTypeList){
				// 		this.feedBackType[item.data_value] = item.data_text
				// 	}
				// 	this.getFeedBackData();
				// 	console.log('feedBackType', this.feedBackType)
				// })
			},
			getFeedBackData(){
				this.$api.baseData_getPmFeedback(this.formData.pm_feedback_id).then((res)=>{
					this.pmFeedback = res.pmFeedback
				})
			},
			back(){
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss" scoped>
@import '@/common/from.scss';
</style>
